const Koa = require("koa");
const serve = require("koa-static");
const path = require("path");
const historyApiFallback = require("koa2-connect-history-api-fallback");

const app = new Koa();
const port = 3000;

// 处理 SPA 应用的路由
app.use(historyApiFallback());

// 配置静态资源服务
app.use(serve(path.join(__dirname, "build")));

app.listen(port, () => {
  console.log(`服务器运行在 http://localhost:${port}`);
});
